const express = require('express')
const mysql = require('mysql')
const conn = mysql.createConnection({
    host:'localhost',
    user:'root',
    password:'root',
    database:'001node_mysql'
})
//--------------查找-----------------
conn.query('select * from 00users',(err,res) => {
    if(err) return console.log('报错');
    console.log(res);
})

//--------------新增------------------
// conn.query('insert into 00users set ?',{uname:'小红',age:16,gender:'女',isdel:0},(err,res) => {
//     if(err) return console.log('报错');
//     console.log(res);
// })

//--------------修改------------------
// const user = {id:3,uname:'小小',age:11,gender:'男',}
// const sqlStr = 'update 00users set ? where id=?'
// conn.query(sqlStr,[user,user.id],(err,res) => {
//     if(err) return console.log('报错');
//     console.log(res);
// })

//---------------删除-----------------
// conn.query('delete from 00users where id = ?',5,(err,res) => {
//         if(err) return console.log('报错');
//         console.log(res);
// })